import json
import requests
import threading
import zlib
from .func import *

class FileRoller(threading.Thread):
    def __init__(self,filename,queue):
        threading.Thread.__init__(self)
        self.queue = queue
        self.filename = filename
        self.running = False

    def run(self):
        if self.running:
            raise 'aready running'
        self.running = True
        f = open(self.filename,'r')
        for line in f.readlines():
            if self.queue.qsize() > 10000:
                time.sleep(1)
            self.queue.put(line)